This article consists ofimportnew - liken translated from Journaldev. Java threads are lightweight processes that perform certain tasks. Java provides multithreaded support through the thread class, and applications can create multiple threads that execute concurrently. There are two types of threads in the application-the user thread and the daemon thread. When the app is started, the main thread is the first user thread created, and we can create mu
, 2=1}HashMap before iterator: {3=1, 2=1, 1=1, 6=1, 5=1, 4=1}HashMap after iterator: {3=1, 2=1, 1=1, 3new=new3, 6=1, 5=1, 4=1}
Finally, if we don't add new elements instead of modifying existing key-value pairs, will it throw an exception?Modify the original program and verify it yourself:
12
//myMap.put(key+"new", "new3");myMap.put(key, "new3");
If you feel confused or shocked by the output, comment below. I would be happy to give a further explanation
will stop until the operation is complete. When the heap is full, you apply for allocating memory to trigger the GC for this reason.Gc_hprof_dump_heapThe GC reason when we created the Hprof file to analyze the heap memory.Gc_explicitWhen we show the call to the System.GC () method, the log will appear.Gc_external_allocThis only appears in API 10 and below, and we don't need to pay attention.The article is partly referenced from:Original link: Journaldev
it is implemented
Journaldev-java, Java EE, Android, Web development Tutorials
Implementation of algorithms and data structures, interview questions and answers: implementation of algorithms and data structures, interview questions and Answers
What is garbage collection: Secret garbage Collection
Learn Java's best must-read book: tamping java Fundamentals
Garbage collection (Java), augmented data (video)
Java off Heap: leaving lot room Java
Java sour
start the next task in the queue again.The timer object can run related tasks as a daemon thread. The Cancel () method of the timer is used to terminate the timer and discard the task to be dispatched. However, the timer does not interfere with the currently executing task and let it end. If the timer is used to execute a daemon thread, it waits for all user threads to terminate, regardless of whether or not it is canceled.The Timer class contains some sechedule () methods to schedule a task to
This paper is translated from Importnew-Journaldev. Welcome to join the translation team. Please refer to the requirements at the end of this article for reprint. To understand the Java garbage collection mechanism, it is important to understand the JVM memory pattern first. Today we will understand the various parts of the JVM's memory, how to monitor it, and the garbage collection tuning. Java (JVM) memory model As you can see from the above pict
Contact Us
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.